#pragma once

#include <glad/glad.h>
#include <sdl.hpp>

#define NK_INCLUDE_FIXED_TYPES
#define NK_INCLUDE_STANDARD_IO
#define NK_INCLUDE_STANDARD_VARARGS
#define NK_INCLUDE_DEFAULT_ALLOCATOR
#define NK_INCLUDE_VERTEX_BUFFER_OUTPUT
#define NK_INCLUDE_FONT_BAKING
#define NK_INCLUDE_DEFAULT_FONT
#include <nuklear.hpp>

class IDrawable {
  public:
    virtual void release() { delete this; }
    virtual const char* title() { return "Nuklear IDrawable"; }
    virtual struct nk_colorf bkcolor() { struct nk_colorf c = { 0.2f, 0.3f, 0.3f, 1.0f }; return std::move(c); }
    virtual void init() {};
    virtual void uninit() {};
    virtual void update(float elapsedTime) {};
    virtual void render() {};
    virtual void imgui(nk_context *ctx, struct nk_rect &rc) {};
    virtual void processInput(sdl::event::Event &evt) {};
};
extern IDrawable* createDrawable();

namespace gl = sdl::gl;
extern sdl::Window::Wrapped window_;
extern gl::Context context_;
extern nk_context *nkctx_;